<script>
	$(document).ready(function(){
		$("dl.text").hide();
		$("select[name=task_type]").change(function(){
			var value = $(this).val();
			if(value=="other"){
				$("dl.text").show();
			}else{
				$("dl.text").hide();
			}
		});
	});
</script>
<div class="pageHeader">
	<form action="/task/add" method="post" class="pageFormContent pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);">
		{% csrf_token %}
		<div class="pageFormContent nowrap">
		<dl>
			<dt>cron:</dt> 
			<dd><input type="text" name="cron" class="required"/></dd>
		</dl>
		<dl>
			<dt>接收人:</dt> 
			<dd>
					<select name="receiver" class="required">
						<option value="{{status.uid}}">本人({{status.uid}})</option>
						{% for contact in contact_list %}
						<option value="{{ contact.uid }}">{{ contact.uid }}</option>
						{% endfor %}
					</select>
			</dd>
		</dl>
		<dl>
			<dt>任务类型:</dt> 
			<dd>
			<select name="task_type">
				{% for key,value in tasks %}
				<option value="{{key}}">{{value}}</option>
				{% endfor %}
			</select>
			</dd>
		</dl>
		<dl class="text">
			<dt>备注:</dt>
			<dd><textarea name="text"></textarea></dd>
		</dl>
		<dl>
			<div class="buttonActive">
				<div class="buttonContent">
					<button type="submit">提交任务</button>
				</div>
			</div>
		</dl>
		</div>
	</form>
</div>
<div class="pageContent">
	<div layoutH="80">
	<table class="list" width="100%">
		<thead>
		<tr>
			<td width="100">电话</td>
			<td width="100">cron</td>
			<td width="300">接收人</td>
			<td width="100">任务类型</td>
			<td>备注</td>
			<td width="100">操作</td>
		</tr>
		</thead>
		<tbody>
		{% for q in list %}
		<tr>
			<td>{{q.phone|slice:"8"}}***</td>
			<td>{{q.cron}}</td>
			<td>{{q.receiver}}</td>
			<td>{{q.task_type}}</td>
			<td>{{q.text}}</td>
			<td><a href="/task/del/{{q.id}}" target="ajaxTodo" title="确定要删除吗?">删除</a></td>
		</tr>
		{% endfor %}
		</tbody>
	</table>
	</div>
</div>


